<template>
    <div class="partner-preview pd-v-24">


        <view class="partner-preview__body mr-t-10">
            <view class="data-preview border16 pd-b-24 overflow-h bg-white">
                <view class="data-preview__header  position-r">
                    <image src="@/static/data_bg.png" mode="aspectFill" class=" position-a full-w full-h left0 top0"></image>
                      
                    <view class="data-preview__header-title pd-h-26 pd-v-24 font28 lh-40 bold flex flex-center position-r">
                        数据概览
                    </view>
                      
                </view>
                  

                <view class="data-preview__body">
                    <view class="flex flex-center">
                        <view class="flex-1 flex flex-center flex-j-center flex-ver">
                            <view class="font36 lh-50 color-default bold">
                                ¥{{ dataOverview.revenueStatistics }}
                            </view>
                            <view class="mr-t-2 font26 lh-36 color-info">
                                收益统计
                            </view>
                              
                        </view>
                        <view class="flex-1 flex flex-center flex-j-center flex-ver">
                            <view class="font36 lh-50 color-default bold">
                                ¥{{ dataOverview.dailyEarnings }}
                            </view>
                            <view class="mr-t-2 font26 lh-36 color-info">
                                当天收益
                            </view>
                              
                        </view>
                        <view class="flex-1 flex flex-center flex-j-center flex-ver">
                            <view class="font36 lh-50 color-default bold">
                                ¥{{ dataOverview.yesterdayEarnings }}
                            </view>
                            <view class="mr-t-2 font26 lh-36 color-info">
                                昨天收益
                            </view>
                              
                        </view>
                          
                    </view>

                    <view class="flex flex-center mr-t-44">
                        <view class="flex-1 flex flex-center flex-j-center flex-ver">
                            <view class="font36 lh-50 color-default bold">
                              {{ dataOverview.deviceStatistics }}
                            </view>
                            <view class="mr-t-2 font26 lh-36 color-info">
                                设备统计
                            </view>
                              
                        </view>
                        <view class="flex-1 flex flex-center flex-j-center flex-ver">
                            <view class="font36 lh-50 color-default bold">
                              {{ dataOverview.orderStatistics }}
                            </view>
                            <view class="mr-t-2 font26 lh-36 color-info">
                                订单统计
                            </view>
                              
                        </view>
                        <view class="flex-1 flex flex-center flex-j-center flex-ver">
                            <view class="font36 lh-50 color-default bold">
                              {{ dataOverview.merchantStatistics }}
                            </view>
                            <view class="mr-t-2 font26 lh-36 color-info">
                                商户统计
                            </view>
                              
                        </view>
                          
                    </view>
                      
                </view>

            </view>
              
        </view>
          
    </div>
</template>

<script setup>



import { useStore } from '@/store/index.js';
import { getDataOverviewForPartnerById } from "@/api/proxy";

import { computed, ref, onMounted, reactive, defineProps } from "vue";
import { onReady,onLoad } from '@dcloudio/uni-app';

const props = defineProps({
    id: {
        type: String,
        default: ''
    }
})

const store = useStore();
const dataOverview = ref({});

onLoad(() => {
  getDataOverviewForPartnerByIdQuery()
})

const getDataOverviewForPartnerByIdQuery = () => {
    getDataOverviewForPartnerById({
        userId: props.id
    }).then(res => {
        if (res.code == 200) {
          dataOverview.value = res.data
        } else {
          uni.showToast({
            title: res.msg,
            icon: 'none'
          })
        }
    })
}

</script>

<style lang="scss" scoped>
.partner-preview {
    min-height:100vh;
    background: #F5F5F5;


    .partner-preview__body {
        .data-preview__header {


            .data-preview__header-title {
                z-index: 2;
                color:#000;
                &::before {
                    content: '';
                    display: block;
                    width:4rpx;
                    height:22rpx;
                    background:#3AC981;
                    margin-right:22rpx;
                }
            }
        }

    }
}
</style>